﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace iTunesFastForward.Genpuid
{
    class ItemsCache
    {
        private Dictionary<string, Artist> _artists;
        private Dictionary<string, Track> _tracks;
        private Dictionary<string, Release> _releases;

        public ItemsCache()
        {
            _artists = new Dictionary<string, Artist>();
            _tracks = new Dictionary<string, Track>();
            _releases = new Dictionary<string, Release>();
        }

        public bool CheckArtist(string mbid)
        {
            return _artists.ContainsKey(mbid);
        }

        public Artist GetArtist(string mbid)
        {
            return _artists[mbid];
        }

        public void AddArtist(Artist art)
        {
            _artists[art.MBID] = art;
        }

        public bool CheckTrack(string mbid)
        {
            return _tracks.ContainsKey(mbid);
        }

        public Track GetTrack(string mbid)
        {
            return _tracks[mbid];
        }

        public void AddTrack(Track t)
        {
            _tracks[t.MBID] = t;
        }

        public bool CheckRelease(string mbid)
        {
            return _releases.ContainsKey(mbid);
        }

        public Release GetRelease(string mbid)
        {
            return _releases[mbid];
        }

        public void AddRelease(Release r)
        {
            _releases[r.MBID] = r;
        }
    }
}
